<<html>
<head>
  <script type="text/javascript" src="../js/jquery.easyui.min.js"></script>
  <jsp:useBean id="F" class="cm309.BookingSystem.FM.factilites" scope="request">
      <jsp:setProperty name="F" property="*" /> 
  </jsp:useBean>
</head>
<body>
   <table id="dg" title="factilites List" class="easyui-datagrid" style="width:550px;height:400px"  
        url="FMActionServlet/ReadFM"  fit=false 
        toolbar="#toolbar"  pagination="true" idField="FactilitesID" idValue="<%=F.getfactilitesID() %>>"
        rownumbers="true" fitColumns="true" singleSelect="true">  
    <thead>  
        <tr>  
            <th field="factilitesName" width="100">factilites Name</th>  
            <th field="FactilitesGender" width="40">Factilites Gender</th>  
            <th field="factilitesAge" width="40">factilites Age</th>  
            <th field="classification" width="50">Classification</th>  
        </tr>  
    </thead>  
</table>  
<div id="toolbar">  
    <a href="#" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="createFM()">New Factilites</a>  
    <a href="#" class="easyui-linkbutton" iconCls="icon-edit" plain="true" onclick="updateFM()">Edit Meember</a>  
    <a href="#" class="easyui-linkbutton" iconCls="icon-remove" plain="true" onclick="deleteFM()">Remove Trainer</a>  
</div>
<!-- easyUI form dialog --><!-- easyUI form dialog --><!-- easyUI form dialog -->  
<div id="dlg" class="easyui-dialog" style="width:400px;height:280px;padding:10px 20px"  
        closed="true" buttons="#dlg-buttons">  
    <div class="ftitle">Trainer Information</div>  
    
    <form id="FM" method="post">  
        <div class="fitem">  
            <label>Factilites ID:</label>  
            <input name="FactilitesID" class="easyui-validatebox" required="true" 
            value='<%=F.getFactilitesID() %>' >  
        </div>  
        <div class="fitem">  
            <label>Factilites Gender:</label>  
             <select id="GenderOPT" class="easyui-combobox" name="factilitesrGender" style="width:153px;"
                 value='<%=F.getFactilitesGender() %>' >  
                  <option value="M">Man</option>  
                  <option value="F">Female</option>  
             </select>

        </div>  
        <div class="fitem">  
            <label>Member Age:</label>  
            <input name="MemberAge"  class="easyui-validatebox" required="true"
            class="easyui-numberbox" data-options="min:0,max:200" 
            value='<%=F.getMemberAge()>'>  
        </div>  
        <div class="fitem">  
            <label>Classification:</label>  
            <input name="classification" class="easyui-validatebox" required="true"
            value='<%=t.getClassification() %>' >  
        </div>  
    </form>  
</div>  
<div id="dlg-buttons">  
    <a href="#" class="easyui-linkbutton" iconCls="icon-ok" onclick="saveMember()">Save</a>  
    <a href="#" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#dlg').dialog('close')">Cancel</a>  
</div>  
<!-- easyUI form dialog --> <!-- easyUI form dialog --> <!-- easyUI form dialog --> 
<!-- easyUI javascript -->


function updateFM(){  
  var row = $('#dg').datagrid('getSelected');  
  if (row){  
      $('#dlg').dialog('open').dialog('setTitle','Edit Trainer');  
      $('#FM').form('load',row);  
      url = 'FMActionServlet/UpdateFM?FactilitesID='+row.MemberID;  
  }  
}

function deleteFM(){  
    var row = $('#dg').datagrid('getSelected');  
    if (row){  
        $.messager.confirm('Confirm','Are you sure you want to destroy this FactilitesNAME?',function(r){  
            if (r){  
                $.post('FMActionServlet/DeleteFM',{factilitesID:row.factilitesID},function(result){ 
                	
                    if (result.success){  
                        $('#dg').datagrid('reload');    // reload the user data  
                    } else {  
                        $.messager.show({   // show error message  
                            title: 'Error',  
                            msg: result.errorMsg  
                        });  
                    }  
                },'json');  
            }  
        });  
    }  
}  
</script>
<!-- easyUI javascript -->
  
</body>
</html><html>
<head>
  <script type="text/javascript" src="../js/jquery.easyui.min.js"></script>
  <jsp:useBean id="t" class="cm309.BookingSystem.FM.factilites" scope="request">
      <jsp:setProperty name="t" property="*" /> 
  </jsp:useBean>
</head>
<body>
   <table id="dg" title="Factilites List" class="easyui-datagrid" style="width:550px;height:400px"  
        url="FMActionServlet/ReadFM"  fit=false 
        toolbar="#toolbar"  pagination="true" idField="FactilitesID" idValue="<%=t.getFactilitesID() %>>"
        rownumbers="true" fitColumns="true" singleSelect="true">  
    <thead>  
        <tr>  
            <th field="trainerName" width="100">Factilites Name</th>  
            <th field="trainerGender" width="40">Factilites Gender</th>  
            <th field="trainerAge" width="40">Member Age</th>  
            <th field="classification" width="50">Classification</th>  
        </tr>  
    </thead>  
</table>  
<div id="toolbar">  
    <a href="#" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="createFM()">New Member</a>  
    <a href="#" class="easyui-linkbutton" iconCls="icon-edit" plain="true" onclick="updateFM()">Edit Factilites</a>  
    <a href="#" class="easyui-linkbutton" iconCls="icon-remove" plain="true" onclick="deleteFM()">Remove Factilites</a>  
</div>
<!-- easyUI form dialog --><!-- easyUI form dialog --><!-- easyUI form dialog -->  
<div id="dlg" class="easyui-dialog" style="width:400px;height:280px;padding:10px 20px"  
        closed="true" buttons="#dlg-buttons">  
    <div class="ftitle">Trainer Information</div>  
    
    <form id="FM" method="post">  
        <div class="fitem">  
            <label>Factilites Name:</label>  
            <input name="FactilitesName" class="easyui-validatebox" required="true" 
            value='<%=F.getFactilitesName() %>' >  
        </div>  
        <div class="fitem">  
            <label>Factilites Gender:</label>  
             <select id="GenderOPT" class="easyui-combobox" name="FactilitesGender" style="width:153px;"
                 value='<%=F.getFactilitesrGender() %>' >  
                  <option value="M">Man</option>  
                  <option value="F">Female</option>  
             </select>

        </div>  
        <div class="fitem">  
            <label>Member Age:</label>  
            <input name="MemberAge"  class="easyui-validatebox" required="true"
            class="easyui-numberbox" data-options="min:0,max:200" 
            value='<%=F.getMemberAge() %>' >  
        </div>  
        <div class="fitem">  
            <label>Classification:</label>  
            <input name="classification" class="easyui-validatebox" required="true"
            value='<%=F.getClassification() %>' >  
        </div>  
    </form>  
</div>  
<div id="dlg-buttons">  
    <a href="#" class="easyui-linkbutton" iconCls="icon-ok" onclick="saveTrainer()">Save</a>  
    <a href="#" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#dlg').dialog('close')">Cancel</a>  
</div>  
<!-- easyUI form dialog --> <!-- easyUI form dialog --> <!-- easyUI form dialog --> 
<!-- easyUI javascript -->
<script>
function createFM(){  
	
    $('#dlg').dialog('open').dialog('setTitle','New Factilites');  
    $('#fm').form('clear');  
    url = 'FMActionServlet/CreateFM';  
} 

function saveMember(){  
    $('#fm').form('submit',{  
        url: url,  
        onSubmit: function(){  
            return $(this).form('validate');  
        },  
        success: function(result){  
            var result = eval('('+result+')');  
            if (result.errorMsg){  
                $.messager.show({  
                    title: 'Error',  
                    msg: result.errorMsg  
                });  
            } else {  
            	$.messager.alert('Info',' Trainer ' + result.trainerName + ' is updated!','info');
                $('#dlg').dialog('close');      // close the dialog  
                $('#dg').datagrid('reload');    // reload the user data  
            }  
        }  
    });  
}  

function updateFM(){  
  var row = $('#dg').datagrid('getSelected');  
  if (row){  
      $('#dlg').dialog('open').dialog('setTitle','Edit Trainer');  
      $('#fm').form('load',row);  
      url = 'FMActionServlet/UpdateFM?MemberID='+row.MemberID;  
  }  
}

function deleteFM(){  
    var row = $('#dg').datagrid('getSelected');  
    if (row){  
        $.messager.confirm('Confirm','Are you sure you want to destroy this Trainer?',function(r){  
            if (r){  
                $.post('FMActionServlet/DeleteFM',{trainerID:row.trainerID},function(result){ 
                	
                    if (result.success){  
                        $('#dg').datagrid('reload');    // reload the user data  
                    } else {  
                        $.messager.show({   // show error message  
                            title: 'Error',  
                            msg: result.errorMsg  
                        });  
                    }  
                },'json');  
            }  
        });  
    }  
}  
</script>
<!-- easyUI javascript -->
  
</body>
</html>